Read and write fix information in delgpl format.
authorrobertl <robertl>
Thu, 6 Aug 2009 19:55:30 +0000 (19:55 +0000)
committerrobertl <robertl>
Thu, 6 Aug 2009 19:55:30 +0000 (19:55 +0000)
delgpl.c

index 544a476e01e478c50b7d16a39db9794dfabbc605..a30b7d5b635b021905732503b8f8c3ae0851b8ab 100644 (file)
--- a/delgpl.c
+++ b/delgpl.c
@@ -71,6 +71,13 @@ gpl_read(void)
                if (wpt_tmp->altitude <= unknown_alt + 1)
                        wpt_tmp->altitude = unknown_alt;
                wpt_tmp->creation_time = le_read32(&gp.tm);
+
+               switch (le_read32(&gp.status)) {
+                       case 1: wpt_tmp->fix = fix_none; break;
+                       case 2: wpt_tmp->fix = fix_2d; break;
+                       case 3: wpt_tmp->fix = fix_3d; break;
+                       case 5: wpt_tmp->fix = fix_dgps; break;
+               }
                
                WAYPT_SET(wpt_tmp, course, le_read_double(&gp.heading));
                WAYPT_SET(wpt_tmp, speed, le_read_double(&gp.speed));
@@ -112,6 +119,14 @@ gpl_trackpt(const waypoint *wpt)
        gpl_point_t gp;
        double speed = 3600*METERS_TO_MILES(wpt->speed);
        double heading = wpt->course;
+
+       switch(wpt->fix) {
+               case fix_none: status = 1; break;
+               case fix_2d: status = 2; break;
+               case fix_3d: status = 3; break;
+               case fix_dgps: status = 5; break;
+               default: status = 3;   // a strategic lie for fix_unknown.
+       }
        
        memset(&gp, 0, sizeof(gp));
        le_write32(&gp.status, status);